package com.gk.panda.apis.enums;

/**
 * @description: 事件类型枚举
 * @date: 2022/10/25 17:48
 **/
public enum BiodiversityEnum {

    KINGDOM(1,"界 0-动物 1-植物"),
    PHYLUM(2,"门"),
    KLASSE(3,"纲"),
    ORDO(4,"目"),
    FAMILY(5,"科"),
    GENUS(6,"属"),
    SPECIES(7,"种"),
    ;


    private final Integer code;
    private final String desc;


    BiodiversityEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    /**
     * 根据code获取值
     * @param code
     * @return
     */
    public static String getDescByCode(Integer code) {
        BiodiversityEnum[] values = BiodiversityEnum.values();
        for (BiodiversityEnum tmp : values){
            if (tmp.getCode().equals(code)){
                return tmp.getDesc();
            }
        }
        return null;
    }
}
